package lily.phs.object;

import lily.phs.database.Constants;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;


public class TwoChild implements Constants{
	
	
	private Context myContext;
	public int twch_profileid=-1;
	private int twch_state=-1;
	public String twch_date="";
	public float twch_weig_value=-1;
	public int twch_weig_choi=-1;
	public float twch_heig_value=-1;
	public int twch_heig_choi=-1;
	public float twch_head_size=-1;
	public int twch_complexion=-1;
	public int twch_skin=-1;
	public int twch_bregma_choi=-1;
	public float twch_bregma_left=-1;
	public float twch_bregma_right=-1;
	public int twch_eye_appearance=-1;
	public int twch_ear_appearance=-1;
	public int twch_hearing=-1;
	public int twch_teething=-1;
	public int twch_cavity=-1;
	public int twch_card=-1;
	public int twch_abdomen=-1;
	public int twch_legs=-1;
	public int twch_gait=-1;
	public int twch_stoop_sign=-1;
	public float twch_sanguine=-1;
	public float twch_activity=-1;
	public float  twch_vd=-1;
	public int twch_deve_asse=-1;
	public int twch_deases=-1;
	public String twch_other="";
	public int twch_refe_choi=-1;
	public String twch_refe_reasion="";
	public String twch_refe_inst="";
	public String twch_guide="";
	public String twch_guide_des="";
	public String twch_next_date="";
	public String twch_doctor="";
	
	public TwoChild(Context context){
		this.myContext=context;
	}
	
	public int getTwch_state() {
		return twch_state;
	}

	public void setTwch_state(int twchState) {
		twch_state = twchState;
	}

	public int getTwch_profileid() {
		return twch_profileid;
	}
	public void setTwch_profileid(int twchProfileid) {
		twch_profileid = twchProfileid;
	}
	public String getTwch_date() {
		return twch_date;
	}
	public void setTwch_date(String twchDate) {
		twch_date = twchDate;
	}
	public float getTwch_weig_value() {
		return twch_weig_value;
	}
	public void setTwch_weig_value(float twchWeigValue) {
		twch_weig_value = twchWeigValue;
	}
	public int getTwch_weig_choi() {
		return twch_weig_choi;
	}
	public void setTwch_weig_choi(int twchWeigChoi) {
		twch_weig_choi = twchWeigChoi;
	}
	public float getTwch_heig_value() {
		return twch_heig_value;
	}
	public void setTwch_heig_value(float twchHeigValue) {
		twch_heig_value = twchHeigValue;
	}
	public int getTwch_heig_choi() {
		return twch_heig_choi;
	}
	public void setTwch_heig_choi(int twchHeigChoi) {
		twch_heig_choi = twchHeigChoi;
	}
	public float getTwch_head_size() {
		return twch_head_size;
	}
	public void setTwch_head_size(float twchHeadSize) {
		twch_head_size = twchHeadSize;
	}
	public int getTwch_complexion() {
		return twch_complexion;
	}
	public void setTwch_complexion(int twchComplexion) {
		twch_complexion = twchComplexion;
	}
	public int getTwch_skin() {
		return twch_skin;
	}
	public void setTwch_skin(int twchSkin) {
		twch_skin = twchSkin;
	}
	public int getTwch_bregma_choi() {
		return twch_bregma_choi;
	}
	public void setTwch_bregma_choi(int twchBregmaChoi) {
		twch_bregma_choi = twchBregmaChoi;
	}
	public float getTwch_bregma_left() {
		return twch_bregma_left;
	}
	public void setTwch_bregma_left(float twchBregmaLeft) {
		twch_bregma_left = twchBregmaLeft;
	}
	public float getTwch_bregma_right() {
		return twch_bregma_right;
	}
	public void setTwch_bregma_right(float twchBregmaRight) {
		twch_bregma_right = twchBregmaRight;
	}
	public int getTwch_eye_appearance() {
		return twch_eye_appearance;
	}
	public void setTwch_eye_appearance(int twchEyeAppearance) {
		twch_eye_appearance = twchEyeAppearance;
	}
	public int getTwch_ear_appearance() {
		return twch_ear_appearance;
	}
	public void setTwch_ear_appearance(int twchEarAppearance) {
		twch_ear_appearance = twchEarAppearance;
	}
	public int getTwch_hearing() {
		return twch_hearing;
	}
	public void setTwch_hearing(int twchHearing) {
		twch_hearing = twchHearing;
	}
	public int getTwch_teething() {
		return twch_teething;
	}
	public void setTwch_teething(int twchTeething) {
		twch_teething = twchTeething;
	}
	public int getTwch_cavity() {
		return twch_cavity;
	}
	public void setTwch_cavity(int twchCavity) {
		twch_cavity = twchCavity;
	}
	public int getTwch_card() {
		return twch_card;
	}
	public void setTwch_card(int twchCard) {
		twch_card = twchCard;
	}
	public int getTwch_abdomen() {
		return twch_abdomen;
	}
	public void setTwch_abdomen(int twchAbdomen) {
		twch_abdomen = twchAbdomen;
	}
	public int getTwch_legs() {
		return twch_legs;
	}
	public void setTwch_legs(int twchLegs) {
		twch_legs = twchLegs;
	}
	public int getTwch_gait() {
		return twch_gait;
	}
	public void setTwch_gait(int twchGait) {
		twch_gait = twchGait;
	}
	public int getTwch_stoop_sign() {
		return twch_stoop_sign;
	}
	public void setTwch_stoop_sign(int twchStoopSign) {
		twch_stoop_sign = twchStoopSign;
	}
	public float getTwch_sanguine() {
		return twch_sanguine;
	}
	public void setTwch_sanguine(float twchSanguine) {
		twch_sanguine = twchSanguine;
	}
	public float getTwch_activity() {
		return twch_activity;
	}
	public void setTwch_activity(float twchActivity) {
		twch_activity = twchActivity;
	}
	public float getTwch_vd() {
		return twch_vd;
	}
	public void setTwch_vd(float twchVd) {
		twch_vd = twchVd;
	}
	public int getTwch_deve_asse() {
		return twch_deve_asse;
	}
	public void setTwch_deve_asse(int twchDeveAsse) {
		twch_deve_asse = twchDeveAsse;
	}
	public int getTwch_deases() {
		return twch_deases;
	}
	public void setTwch_deases(int twchDeases) {
		twch_deases = twchDeases;
	}
	public String getTwch_other() {
		return twch_other;
	}
	public void setTwch_other(String twchOther) {
		twch_other = twchOther;
	}
	public int getTwch_refe_choi() {
		return twch_refe_choi;
	}
	public void setTwch_refe_choi(int twchRefeChoi) {
		twch_refe_choi = twchRefeChoi;
	}
	public String getTwch_refe_reasion() {
		return twch_refe_reasion;
	}
	public void setTwch_refe_reasion(String twchRefeReasion) {
		twch_refe_reasion = twchRefeReasion;
	}
	public String getTwch_refe_inst() {
		return twch_refe_inst;
	}
	public void setTwch_refe_inst(String twchRefeInst) {
		twch_refe_inst = twchRefeInst;
	}
	public String getTwch_guide() {
		return twch_guide;
	}
	public void setTwch_guide(String twchGuide) {
		twch_guide = twchGuide;
	}
	public String getTwch_guide_des() {
		return twch_guide_des;
	}
	public void setTwch_guide_des(String twchGuideDes) {
		twch_guide_des = twchGuideDes;
	}
	public String getTwch_next_date() {
		return twch_next_date;
	}
	public void setTwch_next_date(String twchNextDate) {
		twch_next_date = twchNextDate;
	}
	public String getTwch_doctor() {
		return twch_doctor;
	}
	public void setTwch_doctor(String twchDoctor) {
		twch_doctor = twchDoctor;
	}
	
	public void insertTwoChild(){
		ContentValues value;
		value = new ContentValues();
		value.put(TWCH_PROFILEID , this.twch_profileid);
		value.put(TWCH_STATE , this.twch_state);
		value.put(TWCH_DATE  , this.twch_date);
		value.put(TWCH_WEIG_VALUE , this.twch_weig_value);
		value.put(TWCH_WEIG_CHOI , this.twch_weig_choi);
		value.put(TWCH_HEIG_VALUE  , this.twch_heig_value);
		value.put(TWCH_HEIG_CHOI  , this.twch_heig_choi);
		value.put(TWCH_HEAD_SIZE  , this.twch_head_size);
		value.put(TWCH_COMPLEXION  , this.twch_complexion);
		value.put(TWCH_SKIN  , this.twch_skin);
		value.put(TWCH_BREGMA_CHOI  , this.twch_bregma_choi);
		value.put(TWCH_BREGMA_LEFT  , this.twch_bregma_left);
		value.put(TWCH_BREGMA_RIGHT  , this.twch_bregma_right);
		value.put(TWCH_EYE_APPEARANCE  , this.twch_eye_appearance);
		value.put(TWCH_EAR_APPEARANCE  , this.twch_ear_appearance);
		value.put(TWCH_HEARING  , this.twch_hearing);
		value.put(TWCH_TEETHING  , this.twch_teething);
		value.put(TWCH_CAVITY  , this.twch_cavity);
		value.put(TWCH_CARD  , this.twch_card);
		value.put(TWCH_ABDOMEN  , this.twch_abdomen);
		value.put(TWCH_LEGS  , this.twch_legs);
		value.put(TWCH_GAIT  , this.twch_gait);
		value.put(TWCH_STOOP_SIGN  , this.twch_stoop_sign);
		value.put(TWCH_SANGUINE  , this.twch_sanguine);
		value.put(TWCH_ACTIVITY  , this.twch_activity);
		value.put(TWCH_VD  , this.twch_vd);
		value.put(TWCH_DEVE_ASSE  , this.twch_deve_asse);
		value.put(TWCH_DEASES  , this.twch_deases);
		value.put(TWCH_OTHER  , this.twch_other);
		value.put(TWCH_REFE_CHOI  , this.twch_refe_choi);
		value.put(TWCH_REFE_REASION  , this.twch_refe_reasion);
		value.put(TWCH_REFE_INST  , this.twch_refe_inst);
		value.put(TWCH_GUIDE  , this.twch_guide);
		value.put(TWCH_GUIDE_DES  , this.twch_guide_des);
		value.put(TWCH_NEXT_DATE  , this.twch_next_date);
		value.put(TWCH_DOCTOR , this.twch_doctor);
		myContext.getContentResolver().insert(CONTENT_URI_TB14, value);
	}
	
	public void selectTwoChild(int pro,int state){
		Cursor cursor = myContext.getContentResolver().query(CONTENT_URI_TB14, null,
				TWCH_PROFILEID + "=" + pro + " AND "+TWCH_STATE+"="+state, null, null);
		while(cursor.moveToNext()){
			this.twch_profileid=cursor.getInt(cursor.getColumnIndex(TWCH_PROFILEID ));
			this.twch_state=cursor.getInt(cursor.getColumnIndex(TWCH_STATE ));
			this.twch_date=cursor.getString(cursor.getColumnIndex(TWCH_DATE  ));
			this.twch_weig_value=cursor.getFloat(cursor.getColumnIndex(TWCH_WEIG_VALUE  ));
			this.twch_weig_choi=cursor.getInt(cursor.getColumnIndex(TWCH_WEIG_CHOI  ));
			this.twch_heig_value=cursor.getFloat(cursor.getColumnIndex(TWCH_HEIG_VALUE  ));
			this.twch_heig_choi=cursor.getInt(cursor.getColumnIndex(TWCH_HEIG_CHOI  ));
			this.twch_head_size=cursor.getFloat(cursor.getColumnIndex(TWCH_HEAD_SIZE  ));
			this.twch_complexion=cursor.getInt(cursor.getColumnIndex(TWCH_COMPLEXION  ));
			this.twch_skin=cursor.getInt(cursor.getColumnIndex(TWCH_SKIN  ));
			this.twch_bregma_choi=cursor.getInt(cursor.getColumnIndex(TWCH_BREGMA_CHOI  ));
			this.twch_bregma_left=cursor.getFloat(cursor.getColumnIndex(TWCH_BREGMA_LEFT  ));
			this.twch_bregma_right=cursor.getFloat(cursor.getColumnIndex(TWCH_BREGMA_RIGHT  ));
			this.twch_eye_appearance=cursor.getInt(cursor.getColumnIndex(TWCH_EYE_APPEARANCE  ));
			this.twch_ear_appearance=cursor.getInt(cursor.getColumnIndex(TWCH_EAR_APPEARANCE  ));
			this.twch_hearing=cursor.getInt(cursor.getColumnIndex(TWCH_HEARING  ));
			this.twch_teething=cursor.getInt(cursor.getColumnIndex(TWCH_TEETHING  ));
			this.twch_cavity=cursor.getInt(cursor.getColumnIndex(TWCH_CAVITY ));
			this.twch_card=cursor.getInt(cursor.getColumnIndex(TWCH_CARD  ));
			this.twch_abdomen=cursor.getInt(cursor.getColumnIndex(TWCH_ABDOMEN  ));
			this.twch_legs=cursor.getInt(cursor.getColumnIndex(TWCH_LEGS  ));
			this.twch_gait=cursor.getInt(cursor.getColumnIndex(TWCH_GAIT  ));
			this.twch_stoop_sign=cursor.getInt(cursor.getColumnIndex(TWCH_STOOP_SIGN  ));
			this.twch_sanguine=cursor.getFloat(cursor.getColumnIndex(TWCH_SANGUINE  ));
			this.twch_activity=cursor.getFloat(cursor.getColumnIndex(TWCH_ACTIVITY  ));
			this.twch_vd=cursor.getFloat(cursor.getColumnIndex(TWCH_VD  ));
			this.twch_deve_asse=cursor.getInt(cursor.getColumnIndex(TWCH_DEVE_ASSE  ));
			this.twch_deases=cursor.getInt(cursor.getColumnIndex(TWCH_DEASES  ));
			this.twch_other=cursor.getString(cursor.getColumnIndex(TWCH_OTHER  ));
			this.twch_refe_choi=cursor.getInt(cursor.getColumnIndex(TWCH_REFE_CHOI  ));
			this.twch_refe_reasion=cursor.getString(cursor.getColumnIndex(TWCH_REFE_REASION  ));
			this.twch_refe_inst=cursor.getString(cursor.getColumnIndex(TWCH_REFE_INST  ));
			this.twch_guide=cursor.getString(cursor.getColumnIndex(TWCH_GUIDE  ));
			this.twch_guide_des=cursor.getString(cursor.getColumnIndex(TWCH_GUIDE_DES  ));
			this.twch_next_date=cursor.getString(cursor.getColumnIndex(TWCH_NEXT_DATE  ));
			this.twch_doctor=cursor.getString(cursor.getColumnIndex(TWCH_DOCTOR  ));
		}
		cursor.close();
	}
	
	public void deleteTwoChild(int pro){
		myContext.getContentResolver().delete(CONTENT_URI_TB14,
				TWCH_PROFILEID + "=" + pro + "", null);
	}
	
	public void updateTwoChild(int pro,int state){
		ContentValues value;
		value = new ContentValues();
		//value.put(TWCH_PROFILEID , this.twch_profileid);
		value.put(TWCH_STATE , this.twch_state);
		value.put(TWCH_DATE  , this.twch_date);
		value.put(TWCH_WEIG_VALUE , this.twch_weig_value);
		value.put(TWCH_WEIG_CHOI , this.twch_weig_choi);
		value.put(TWCH_HEIG_VALUE  , this.twch_heig_value);
		value.put(TWCH_HEIG_CHOI  , this.twch_heig_choi);
		value.put(TWCH_HEAD_SIZE  , this.twch_head_size);
		value.put(TWCH_COMPLEXION  , this.twch_complexion);
		value.put(TWCH_SKIN  , this.twch_skin);
		value.put(TWCH_BREGMA_CHOI  , this.twch_bregma_choi);
		value.put(TWCH_BREGMA_LEFT  , this.twch_bregma_left);
		value.put(TWCH_BREGMA_RIGHT  , this.twch_bregma_right);
		value.put(TWCH_EYE_APPEARANCE  , this.twch_eye_appearance);
		value.put(TWCH_EAR_APPEARANCE  , this.twch_ear_appearance);
		value.put(TWCH_HEARING  , this.twch_hearing);
		value.put(TWCH_TEETHING  , this.twch_teething);
		value.put(TWCH_CAVITY  , this.twch_cavity);
		value.put(TWCH_CARD  , this.twch_card);
		value.put(TWCH_ABDOMEN  , this.twch_abdomen);
		value.put(TWCH_LEGS  , this.twch_legs);
		value.put(TWCH_GAIT  , this.twch_gait);
		value.put(TWCH_STOOP_SIGN  , this.twch_stoop_sign);
		value.put(TWCH_SANGUINE  , this.twch_sanguine);
		value.put(TWCH_ACTIVITY  , this.twch_activity);
		value.put(TWCH_VD  , this.twch_vd);
		value.put(TWCH_DEVE_ASSE  , this.twch_deve_asse);
		value.put(TWCH_DEASES  , this.twch_deases);
		value.put(TWCH_OTHER  , this.twch_other);
		value.put(TWCH_REFE_CHOI  , this.twch_refe_choi);
		value.put(TWCH_REFE_REASION  , this.twch_refe_reasion);
		value.put(TWCH_REFE_INST  , this.twch_refe_inst);
		value.put(TWCH_GUIDE  , this.twch_guide);
		value.put(TWCH_GUIDE_DES  , this.twch_guide_des);
		value.put(TWCH_NEXT_DATE  , this.twch_next_date);
		value.put(TWCH_DOCTOR , this.twch_doctor);
		myContext.getContentResolver().update(CONTENT_URI_TB14, value, 
				TWCH_PROFILEID + "=" + pro + " AND "+TWCH_STATE+"="+state, null);
	}

}
